Skip to content

Blocks: Share window listeners across instances (block props, rich text, ...)#78310

Merged
ellatrix merged 27 commits into
trunkfrom
perf/share-rich-text-document-listeners
May 20, 2026
Merged

Blocks: Share window listeners across instances (block props, rich text, ...)#78310
ellatrix merged 27 commits into
trunkfrom
perf/share-rich-text-document-listeners

Conversation

@ellatrix
Copy link
Copy Markdown
Member

@ellatrix ellatrix commented May 14, 2026

What?

Collapse ~19 per-block native event listeners (14 per RichText + 3 per block wrapper + 1 from block-library + 1 from Autocomplete) into shared document listeners via a new subscribeSharedListener helper in @wordpress/compose.

Why?

On a large post, the editor was registering ~26k native event listeners on mount. The C++↔JS boundary crossings show up as a wide band of addEventListener calls during load. React already does this for synthetic events (one delegated listener at the root); this PR applies the same pattern to the editor's useRefEffect listeners that React doesn't cover.

How?

  1. subscribeSharedListener( target, eventType, callback, capture ) in @wordpress/compose — lazily registers one native listener per (target, eventType, phase) and fans out to subscribers via an in-JS Set. Capture-phase variant for handlers that need to fire before ancestor bubble listeners gating on event.defaultPrevented.
  2. Rich text (@wordpress/rich-text) — all seven event-listener modules (copy-handler, prevent-focus-capture, delete, format-boundaries, select-object, selection-change-compat, input-and-selection) migrated. Element-level listeners gone; subscribers join the shared Set and bail on ! element.contains( event.target ) (or equivalent).
  3. Block editor (@wordpress/block-editor) — use-focus-handler, use-is-hovered, and the rich-text wrappers enter / paste-handler migrated.
  4. Block library (@wordpress/block-library) — paragraph/use-enter, list-item/use-enter, list-item/use-space, button use-enter migrated (capture phase to preserve the trunk ordering against writing-flow's defaultPrevented gate).
  5. Components (@wordpress/components) — Autocomplete's per-instance keydown listener migrated (capture phase).

Testing Instructions

  1. Open a large post in the editor.
  2. Inspect the document/window's listener count in DevTools → before: ~26k, after: ~2k.

Screenshots

26k → 2k event listeners (large document)

Before After
Before After

They also show up during editor mount — all the gold addEventListener calls in this window:

image

Use of AI Tools

Authored with Claude Code assistance; reviewed and verified by the author.

@github-actions github-actions Bot added the [Package] Rich text /packages/rich-text label May 14, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label May 14, 2026
@ellatrix ellatrix force-pushed the perf/share-rich-text-document-listeners branch from a5234d3 to 889189c Compare May 14, 2026 18:30
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 2026

Size Change: +661 B (+0.01%)

Total Size: 7.98 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 346 kB +49 B (+0.01%)
build/scripts/block-library/index.min.js 323 kB +38 B (+0.01%)
build/scripts/components/index.min.js 267 kB -26 B (-0.01%)
build/scripts/compose/index.min.js 11.6 kB +491 B (+4.43%)
build/scripts/private-apis/index.min.js 1.14 kB +3 B (+0.26%)
build/scripts/rich-text/index.min.js 14.1 kB +106 B (+0.75%)
ℹ️ View Unchanged
Filename Size
build/modules/a11y/index.min.js 355 B
build/modules/abilities/index.min.js 42.3 kB
build/modules/block-editor/utils/fit-text-frontend.min.js 617 B
build/modules/block-library/accordion/view.min.js 595 B
build/modules/block-library/file/view.min.js 346 B
build/modules/block-library/form/view.min.js 528 B
build/modules/block-library/image/view.min.js 2.64 kB
build/modules/block-library/navigation/view.min.js 1.14 kB
build/modules/block-library/playlist/view.min.js 10.9 kB
build/modules/block-library/query/view.min.js 518 B
build/modules/block-library/search/view.min.js 498 B
build/modules/block-library/tabs/view.min.js 946 B
build/modules/boot/index.min.js 19.6 kB
build/modules/connectors/index.min.js 2.05 kB
build/modules/content-types/index.min.js 156 kB
build/modules/core-abilities/index.min.js 926 B
build/modules/edit-site-init/index.min.js 1.4 kB
build/modules/interactivity-router/full-page.min.js 451 B
build/modules/interactivity-router/index.min.js 11.6 kB
build/modules/interactivity/index.min.js 15.3 kB
build/modules/latex-to-mathml/index.min.js 56.5 kB
build/modules/latex-to-mathml/loader.min.js 131 B
build/modules/lazy-editor/index.min.js 14.2 kB
build/modules/route/index.min.js 25.2 kB
build/modules/vips/loader.min.js 127 B
build/modules/vips/worker.min.js 4.56 MB
build/modules/workflow/index.min.js 19.9 kB
build/scripts/a11y/index.min.js 1.1 kB
build/scripts/annotations/index.min.js 2.53 kB
build/scripts/api-fetch/index.min.js 2.86 kB
build/scripts/autop/index.min.js 2.21 kB
build/scripts/base-styles/index.min.js 146 B
build/scripts/blob/index.min.js 665 B
build/scripts/block-directory/index.min.js 10.3 kB
build/scripts/block-serialization-default-parser/index.min.js 1.2 kB
build/scripts/block-serialization-spec-parser/index.min.js 3.12 kB
build/scripts/blocks/index.min.js 57.1 kB
build/scripts/commands/index.min.js 21 kB
build/scripts/core-commands/index.min.js 4.37 kB
build/scripts/core-data/index.min.js 31.3 kB
build/scripts/customize-widgets/index.min.js 14.6 kB
build/scripts/data-controls/index.min.js 832 B
build/scripts/data/index.min.js 9.72 kB
build/scripts/date/index.min.js 23.7 kB
build/scripts/deprecated/index.min.js 784 B
build/scripts/dom-ready/index.min.js 502 B
build/scripts/dom/index.min.js 5.04 kB
build/scripts/edit-post/index.min.js 19 kB
build/scripts/edit-site/index.min.js 266 kB
build/scripts/edit-widgets/index.min.js 22.2 kB
build/scripts/editor/index.min.js 431 kB
build/scripts/element/index.min.js 5.2 kB
build/scripts/escape-html/index.min.js 622 B
build/scripts/format-library/index.min.js 13.1 kB
build/scripts/hooks/index.min.js 1.86 kB
build/scripts/html-entities/index.min.js 529 B
build/scripts/i18n/index.min.js 2.5 kB
build/scripts/is-shallow-equal/index.min.js 607 B
build/scripts/keyboard-shortcuts/index.min.js 1.65 kB
build/scripts/keycodes/index.min.js 1.6 kB
build/scripts/list-reusable-blocks/index.min.js 2.53 kB
build/scripts/media-utils/index.min.js 79.9 kB
build/scripts/notices/index.min.js 1.72 kB
build/scripts/nux/index.min.js 1.92 kB
build/scripts/patterns/index.min.js 8 kB
build/scripts/plugins/index.min.js 2.18 kB
build/scripts/preferences-persistence/index.min.js 2.19 kB
build/scripts/preferences/index.min.js 3.33 kB
build/scripts/primitives/index.min.js 1.05 kB
build/scripts/priority-queue/index.min.js 1.65 kB
build/scripts/react-i18n/index.min.js 868 B
build/scripts/redux-routine/index.min.js 3.4 kB
build/scripts/reusable-blocks/index.min.js 3.14 kB
build/scripts/router/index.min.js 5.99 kB
build/scripts/server-side-render/index.min.js 1.94 kB
build/scripts/shortcode/index.min.js 1.62 kB
build/scripts/style-engine/index.min.js 2.45 kB
build/scripts/sync/index.min.js 39.4 kB
build/scripts/theme/index.min.js 22.3 kB
build/scripts/token-list/index.min.js 767 B
build/scripts/undo-manager/index.min.js 954 B
build/scripts/upload-media/index.min.js 11.5 kB
build/scripts/url/index.min.js 4.02 kB
build/scripts/vendors/react-dom.min.js 43.3 kB
build/scripts/vendors/react-jsx-runtime.min.js 667 B
build/scripts/vendors/react.min.js 2.77 kB
build/scripts/viewport/index.min.js 1.25 kB
build/scripts/warning/index.min.js 482 B
build/scripts/widgets/index.min.js 7.84 kB
build/scripts/wordcount/index.min.js 1.07 kB
build/styles/base-styles/admin-schemes-rtl.css 1.71 kB
build/styles/base-styles/admin-schemes-rtl.min.css 775 B
build/styles/base-styles/admin-schemes.css 1.71 kB
build/styles/base-styles/admin-schemes.min.css 775 B
build/styles/block-directory/style-rtl.css 1.97 kB
build/styles/block-directory/style-rtl.min.css 1.06 kB
build/styles/block-directory/style.css 1.98 kB
build/styles/block-directory/style.min.css 1.06 kB
build/styles/block-editor/content-rtl.css 5.42 kB
build/styles/block-editor/content-rtl.min.css 3.99 kB
build/styles/block-editor/content.css 5.42 kB
build/styles/block-editor/content.min.css 3.99 kB
build/styles/block-editor/default-editor-styles-rtl.css 697 B
build/styles/block-editor/default-editor-styles-rtl.min.css 224 B
build/styles/block-editor/default-editor-styles.css 697 B
build/styles/block-editor/default-editor-styles.min.css 224 B
build/styles/block-editor/style-rtl.css 18.6 kB
build/styles/block-editor/style-rtl.min.css 15.9 kB
build/styles/block-editor/style.css 18.7 kB
build/styles/block-editor/style.min.css 15.9 kB
build/styles/block-library/accordion-heading/style-rtl.css 346 B
build/styles/block-library/accordion-heading/style-rtl.min.css 325 B
build/styles/block-library/accordion-heading/style.css 346 B
build/styles/block-library/accordion-heading/style.min.css 325 B
build/styles/block-library/accordion-item/style-rtl.css 239 B
build/styles/block-library/accordion-item/style-rtl.min.css 180 B
build/styles/block-library/accordion-item/style.css 238 B
build/styles/block-library/accordion-item/style.min.css 180 B
build/styles/block-library/accordion-panel/style-rtl.css 110 B
build/styles/block-library/accordion-panel/style-rtl.min.css 99 B
build/styles/block-library/accordion-panel/style.css 110 B
build/styles/block-library/accordion-panel/style.min.css 99 B
build/styles/block-library/accordion/style-rtl.css 69 B
build/styles/block-library/accordion/style-rtl.min.css 62 B
build/styles/block-library/accordion/style.css 69 B
build/styles/block-library/accordion/style.min.css 62 B
build/styles/block-library/archives/style-rtl.css 101 B
build/styles/block-library/archives/style-rtl.min.css 90 B
build/styles/block-library/archives/style.css 101 B
build/styles/block-library/archives/style.min.css 90 B
build/styles/block-library/audio/editor-rtl.css 166 B
build/styles/block-library/audio/editor-rtl.min.css 149 B
build/styles/block-library/audio/editor.css 166 B
build/styles/block-library/audio/editor.min.css 151 B
build/styles/block-library/audio/style-rtl.css 945 B
build/styles/block-library/audio/style-rtl.min.css 132 B
build/styles/block-library/audio/style.css 945 B
build/styles/block-library/audio/style.min.css 132 B
build/styles/block-library/audio/theme-rtl.css 967 B
build/styles/block-library/audio/theme-rtl.min.css 134 B
build/styles/block-library/audio/theme.css 967 B
build/styles/block-library/audio/theme.min.css 134 B
build/styles/block-library/avatar/editor-rtl.css 127 B
build/styles/block-library/avatar/editor-rtl.min.css 115 B
build/styles/block-library/avatar/editor.css 127 B
build/styles/block-library/avatar/editor.min.css 115 B
build/styles/block-library/avatar/style-rtl.css 117 B
build/styles/block-library/avatar/style-rtl.min.css 104 B
build/styles/block-library/avatar/style.css 117 B
build/styles/block-library/avatar/style.min.css 104 B
build/styles/block-library/breadcrumbs/style-rtl.css 233 B
build/styles/block-library/breadcrumbs/style-rtl.min.css 203 B
build/styles/block-library/breadcrumbs/style.css 233 B
build/styles/block-library/breadcrumbs/style.min.css 203 B
build/styles/block-library/button/editor-rtl.css 306 B
build/styles/block-library/button/editor-rtl.min.css 265 B
build/styles/block-library/button/editor.css 317 B
build/styles/block-library/button/editor.min.css 265 B
build/styles/block-library/button/style-rtl.css 651 B
build/styles/block-library/button/style-rtl.min.css 596 B
build/styles/block-library/button/style.css 662 B
build/styles/block-library/button/style.min.css 596 B
build/styles/block-library/buttons/editor-rtl.css 391 B
build/styles/block-library/buttons/editor-rtl.min.css 291 B
build/styles/block-library/buttons/editor.css 391 B
build/styles/block-library/buttons/editor.min.css 291 B
build/styles/block-library/buttons/style-rtl.css 452 B
build/styles/block-library/buttons/style-rtl.min.css 349 B
build/styles/block-library/buttons/style.css 453 B
build/styles/block-library/buttons/style.min.css 349 B
build/styles/block-library/calendar/style-rtl.css 271 B
build/styles/block-library/calendar/style-rtl.min.css 239 B
build/styles/block-library/calendar/style.css 271 B
build/styles/block-library/calendar/style.min.css 239 B
build/styles/block-library/categories/editor-rtl.css 171 B
build/styles/block-library/categories/editor-rtl.min.css 132 B
build/styles/block-library/categories/editor.css 170 B
build/styles/block-library/categories/editor.min.css 131 B
build/styles/block-library/categories/style-rtl.css 226 B
build/styles/block-library/categories/style-rtl.min.css 169 B
build/styles/block-library/categories/style.css 235 B
build/styles/block-library/categories/style.min.css 169 B
build/styles/block-library/classic-rtl.css 402 B
build/styles/block-library/classic-rtl.min.css 358 B
build/styles/block-library/classic.css 402 B
build/styles/block-library/classic.min.css 358 B
build/styles/block-library/code/editor-rtl.css 59 B
build/styles/block-library/code/editor-rtl.min.css 53 B
build/styles/block-library/code/editor.css 59 B
build/styles/block-library/code/editor.min.css 53 B
build/styles/block-library/code/style-rtl.css 158 B
build/styles/block-library/code/style-rtl.min.css 140 B
build/styles/block-library/code/style.css 178 B
build/styles/block-library/code/style.min.css 140 B
build/styles/block-library/code/theme-rtl.css 135 B
build/styles/block-library/code/theme-rtl.min.css 122 B
build/styles/block-library/code/theme.css 135 B
build/styles/block-library/code/theme.min.css 122 B
build/styles/block-library/columns/editor-rtl.css 119 B
build/styles/block-library/columns/editor-rtl.min.css 108 B
build/styles/block-library/columns/editor.css 119 B
build/styles/block-library/columns/editor.min.css 108 B
build/styles/block-library/columns/style-rtl.css 1.3 kB
build/styles/block-library/columns/style-rtl.min.css 421 B
build/styles/block-library/columns/style.css 1.3 kB
build/styles/block-library/columns/style.min.css 421 B
build/styles/block-library/comment-author-avatar/editor-rtl.css 136 B
build/styles/block-library/comment-author-avatar/editor-rtl.min.css 124 B
build/styles/block-library/comment-author-avatar/editor.css 136 B
build/styles/block-library/comment-author-avatar/editor.min.css 124 B
build/styles/block-library/comment-author-name/style-rtl.css 79 B
build/styles/block-library/comment-author-name/style-rtl.min.css 72 B
build/styles/block-library/comment-author-name/style.css 79 B
build/styles/block-library/comment-author-name/style.min.css 72 B
build/styles/block-library/comment-content/style-rtl.css 137 B
build/styles/block-library/comment-content/style-rtl.min.css 120 B
build/styles/block-library/comment-content/style.css 137 B
build/styles/block-library/comment-content/style.min.css 120 B
build/styles/block-library/comment-date/style-rtl.css 72 B
build/styles/block-library/comment-date/style-rtl.min.css 65 B
build/styles/block-library/comment-date/style.css 72 B
build/styles/block-library/comment-date/style.min.css 65 B
build/styles/block-library/comment-edit-link/style-rtl.css 77 B
build/styles/block-library/comment-edit-link/style-rtl.min.css 70 B
build/styles/block-library/comment-edit-link/style.css 77 B
build/styles/block-library/comment-edit-link/style.min.css 70 B
build/styles/block-library/comment-reply-link/style-rtl.css 78 B
build/styles/block-library/comment-reply-link/style-rtl.min.css 71 B
build/styles/block-library/comment-reply-link/style.css 78 B
build/styles/block-library/comment-reply-link/style.min.css 71 B
build/styles/block-library/comment-template/style-rtl.css 213 B
build/styles/block-library/comment-template/style-rtl.min.css 191 B
build/styles/block-library/comment-template/style.css 213 B
build/styles/block-library/comment-template/style.min.css 191 B
build/styles/block-library/comments-pagination-numbers/editor-rtl.css 135 B
build/styles/block-library/comments-pagination-numbers/editor-rtl.min.css 122 B
build/styles/block-library/comments-pagination-numbers/editor.css 144 B
build/styles/block-library/comments-pagination-numbers/editor.min.css 121 B
build/styles/block-library/comments-pagination/editor-rtl.css 184 B
build/styles/block-library/comments-pagination/editor-rtl.min.css 168 B
build/styles/block-library/comments-pagination/editor.css 184 B
build/styles/block-library/comments-pagination/editor.min.css 168 B
build/styles/block-library/comments-pagination/style-rtl.css 224 B
build/styles/block-library/comments-pagination/style-rtl.min.css 201 B
build/styles/block-library/comments-pagination/style.css 236 B
build/styles/block-library/comments-pagination/style.min.css 201 B
build/styles/block-library/comments-title/editor-rtl.css 83 B
build/styles/block-library/comments-title/editor-rtl.min.css 75 B
build/styles/block-library/comments-title/editor.css 83 B
build/styles/block-library/comments-title/editor.min.css 75 B
build/styles/block-library/comments/editor-rtl.css 968 B
build/styles/block-library/comments/editor-rtl.min.css 842 B
build/styles/block-library/comments/editor.css 968 B
build/styles/block-library/comments/editor.min.css 842 B
build/styles/block-library/comments/style-rtl.css 754 B
build/styles/block-library/comments/style-rtl.min.css 637 B
build/styles/block-library/comments/style.css 752 B
build/styles/block-library/comments/style.min.css 637 B
build/styles/block-library/common-rtl.css 2.48 kB
build/styles/block-library/common-rtl.min.css 1.12 kB
build/styles/block-library/common.css 2.5 kB
build/styles/block-library/common.min.css 1.12 kB
build/styles/block-library/cover/editor-rtl.css 1.05 kB
build/styles/block-library/cover/editor-rtl.min.css 631 B
build/styles/block-library/cover/editor.css 1.05 kB
build/styles/block-library/cover/editor.min.css 631 B
build/styles/block-library/cover/style-rtl.css 2.5 kB
build/styles/block-library/cover/style-rtl.min.css 1.82 kB
build/styles/block-library/cover/style.css 2.51 kB
build/styles/block-library/cover/style.min.css 1.81 kB
build/styles/block-library/details/editor-rtl.css 72 B
build/styles/block-library/details/editor-rtl.min.css 65 B
build/styles/block-library/details/editor.css 72 B
build/styles/block-library/details/editor.min.css 65 B
build/styles/block-library/details/style-rtl.css 97 B
build/styles/block-library/details/style-rtl.min.css 86 B
build/styles/block-library/details/style.css 97 B
build/styles/block-library/details/style.min.css 86 B
build/styles/block-library/editor-elements-rtl.css 117 B
build/styles/block-library/editor-elements-rtl.min.css 75 B
build/styles/block-library/editor-elements.css 117 B
build/styles/block-library/editor-elements.min.css 75 B
build/styles/block-library/editor-rtl.css 12.5 kB
build/styles/block-library/editor-rtl.min.css 10.3 kB
build/styles/block-library/editor.css 12.5 kB
build/styles/block-library/editor.min.css 10.3 kB
build/styles/block-library/elements-rtl.css 84 B
build/styles/block-library/elements-rtl.min.css 54 B
build/styles/block-library/elements.css 84 B
build/styles/block-library/elements.min.css 54 B
build/styles/block-library/embed/editor-rtl.css 391 B
build/styles/block-library/embed/editor-rtl.min.css 331 B
build/styles/block-library/embed/editor.css 390 B
build/styles/block-library/embed/editor.min.css 331 B
build/styles/block-library/embed/style-rtl.css 1.29 kB
build/styles/block-library/embed/style-rtl.min.css 448 B
build/styles/block-library/embed/style.css 1.29 kB
build/styles/block-library/embed/style.min.css 448 B
build/styles/block-library/embed/theme-rtl.css 967 B
build/styles/block-library/embed/theme-rtl.min.css 133 B
build/styles/block-library/embed/theme.css 967 B
build/styles/block-library/embed/theme.min.css 133 B
build/styles/block-library/file/editor-rtl.css 352 B
build/styles/block-library/file/editor-rtl.min.css 324 B
build/styles/block-library/file/editor.css 353 B
build/styles/block-library/file/editor.min.css 324 B
build/styles/block-library/file/style-rtl.css 318 B
build/styles/block-library/file/style-rtl.min.css 278 B
build/styles/block-library/file/style.css 331 B
build/styles/block-library/file/style.min.css 278 B
build/styles/block-library/footnotes/style-rtl.css 220 B
build/styles/block-library/footnotes/style-rtl.min.css 198 B
build/styles/block-library/footnotes/style.css 219 B
build/styles/block-library/footnotes/style.min.css 197 B
build/styles/block-library/form-input/editor-rtl.css 286 B
build/styles/block-library/form-input/editor-rtl.min.css 265 B
build/styles/block-library/form-input/editor.css 285 B
build/styles/block-library/form-input/editor.min.css 264 B
build/styles/block-library/form-input/style-rtl.css 467 B
build/styles/block-library/form-input/style-rtl.min.css 366 B
build/styles/block-library/form-input/style.css 467 B
build/styles/block-library/form-input/style.min.css 366 B
build/styles/block-library/form-submission-notification/editor-rtl.css 368 B
build/styles/block-library/form-submission-notification/editor-rtl.min.css 344 B
build/styles/block-library/form-submission-notification/editor.css 368 B
build/styles/block-library/form-submission-notification/editor.min.css 341 B
build/styles/block-library/form-submit-button/style-rtl.css 77 B
build/styles/block-library/form-submit-button/style-rtl.min.css 69 B
build/styles/block-library/form-submit-button/style.css 77 B
build/styles/block-library/form-submit-button/style.min.css 69 B
build/styles/block-library/freeform/editor-rtl.css 1.12 kB
build/styles/block-library/freeform/editor-rtl.min.css 288 B
build/styles/block-library/freeform/editor.css 1.12 kB
build/styles/block-library/freeform/editor.min.css 288 B
build/styles/block-library/gallery/editor-rtl.css 1.46 kB
build/styles/block-library/gallery/editor-rtl.min.css 561 B
build/styles/block-library/gallery/editor.css 1.46 kB
build/styles/block-library/gallery/editor.min.css 564 B
build/styles/block-library/gallery/style-rtl.css 2.84 kB
build/styles/block-library/gallery/style-rtl.min.css 1.84 kB
build/styles/block-library/gallery/style.css 2.84 kB
build/styles/block-library/gallery/style.min.css 1.84 kB
build/styles/block-library/gallery/theme-rtl.css 941 B
build/styles/block-library/gallery/theme-rtl.min.css 108 B
build/styles/block-library/gallery/theme.css 941 B
build/styles/block-library/gallery/theme.min.css 108 B
build/styles/block-library/group/editor-rtl.css 772 B
build/styles/block-library/group/editor-rtl.min.css 335 B
build/styles/block-library/group/editor.css 772 B
build/styles/block-library/group/editor.min.css 335 B
build/styles/block-library/group/style-rtl.css 120 B
build/styles/block-library/group/style-rtl.min.css 103 B
build/styles/block-library/group/style.css 120 B
build/styles/block-library/group/style.min.css 103 B
build/styles/block-library/group/theme-rtl.css 468 B
build/styles/block-library/group/theme-rtl.min.css 79 B
build/styles/block-library/group/theme.css 468 B
build/styles/block-library/group/theme.min.css 79 B
build/styles/block-library/heading/style-rtl.css 604 B
build/styles/block-library/heading/style-rtl.min.css 205 B
build/styles/block-library/heading/style.css 604 B
build/styles/block-library/heading/style.min.css 205 B
build/styles/block-library/html/editor-rtl.css 1.29 kB
build/styles/block-library/html/editor-rtl.min.css 464 B
build/styles/block-library/html/editor.css 1.3 kB
build/styles/block-library/html/editor.min.css 464 B
build/styles/block-library/icon/editor-rtl.css 776 B
build/styles/block-library/icon/editor-rtl.min.css 377 B
build/styles/block-library/icon/editor.css 776 B
build/styles/block-library/icon/editor.min.css 377 B
build/styles/block-library/icon/style-rtl.css 218 B
build/styles/block-library/icon/style-rtl.min.css 154 B
build/styles/block-library/icon/style.css 218 B
build/styles/block-library/icon/style.min.css 154 B
build/styles/block-library/image/editor-rtl.css 1.64 kB
build/styles/block-library/image/editor-rtl.min.css 782 B
build/styles/block-library/image/editor.css 1.64 kB
build/styles/block-library/image/editor.min.css 780 B
build/styles/block-library/image/style-rtl.css 2.92 kB
build/styles/block-library/image/style-rtl.min.css 1.86 kB
build/styles/block-library/image/style.css 2.92 kB
build/styles/block-library/image/style.min.css 1.85 kB
build/styles/block-library/image/theme-rtl.css 971 B
build/styles/block-library/image/theme-rtl.min.css 137 B
build/styles/block-library/image/theme.css 971 B
build/styles/block-library/image/theme.min.css 137 B
build/styles/block-library/latest-comments/style-rtl.css 392 B
build/styles/block-library/latest-comments/style-rtl.min.css 352 B
build/styles/block-library/latest-comments/style.css 390 B
build/styles/block-library/latest-comments/style.min.css 352 B
build/styles/block-library/latest-posts/editor-rtl.css 154 B
build/styles/block-library/latest-posts/editor-rtl.min.css 139 B
build/styles/block-library/latest-posts/editor.css 153 B
build/styles/block-library/latest-posts/editor.min.css 138 B
build/styles/block-library/latest-posts/style-rtl.css 1.36 kB
build/styles/block-library/latest-posts/style-rtl.min.css 520 B
build/styles/block-library/latest-posts/style.css 1.37 kB
build/styles/block-library/latest-posts/style.min.css 520 B
build/styles/block-library/list/style-rtl.css 498 B
build/styles/block-library/list/style-rtl.min.css 107 B
build/styles/block-library/list/style.css 498 B
build/styles/block-library/list/style.min.css 107 B
build/styles/block-library/loginout/style-rtl.css 68 B
build/styles/block-library/loginout/style-rtl.min.css 61 B
build/styles/block-library/loginout/style.css 68 B
build/styles/block-library/loginout/style.min.css 61 B
build/styles/block-library/math/editor-rtl.css 491 B
build/styles/block-library/math/editor-rtl.min.css 105 B
build/styles/block-library/math/editor.css 502 B
build/styles/block-library/math/editor.min.css 105 B
build/styles/block-library/math/style-rtl.css 70 B
build/styles/block-library/math/style-rtl.min.css 61 B
build/styles/block-library/math/style.css 70 B
build/styles/block-library/math/style.min.css 61 B
build/styles/block-library/media-text/editor-rtl.css 389 B
build/styles/block-library/media-text/editor-rtl.min.css 321 B
build/styles/block-library/media-text/editor.css 389 B
build/styles/block-library/media-text/editor.min.css 320 B
build/styles/block-library/media-text/style-rtl.css 873 B
build/styles/block-library/media-text/style-rtl.min.css 552 B
build/styles/block-library/media-text/style.css 901 B
build/styles/block-library/media-text/style.min.css 550 B
build/styles/block-library/more/editor-rtl.css 796 B
build/styles/block-library/more/editor-rtl.min.css 393 B
build/styles/block-library/more/editor.css 798 B
build/styles/block-library/more/editor.min.css 393 B
build/styles/block-library/navigation-link/editor-rtl.css 1.28 kB
build/styles/block-library/navigation-link/editor-rtl.min.css 710 B
build/styles/block-library/navigation-link/editor.css 1.27 kB
build/styles/block-library/navigation-link/editor.min.css 713 B
build/styles/block-library/navigation-link/style-rtl.css 579 B
build/styles/block-library/navigation-link/style-rtl.min.css 190 B
build/styles/block-library/navigation-link/style.css 579 B
build/styles/block-library/navigation-link/style.min.css 188 B
build/styles/block-library/navigation-overlay-close/style-rtl.css 260 B
build/styles/block-library/navigation-overlay-close/style-rtl.min.css 237 B
build/styles/block-library/navigation-overlay-close/style.css 260 B
build/styles/block-library/navigation-overlay-close/style.min.css 237 B
build/styles/block-library/navigation-submenu/editor-rtl.css 1.12 kB
build/styles/block-library/navigation-submenu/editor-rtl.min.css 295 B
build/styles/block-library/navigation-submenu/editor.css 1.12 kB
build/styles/block-library/navigation-submenu/editor.min.css 294 B
build/styles/block-library/navigation/editor-rtl.css 3.28 kB
build/styles/block-library/navigation/editor-rtl.min.css 2.28 kB
build/styles/block-library/navigation/editor.css 3.29 kB
build/styles/block-library/navigation/editor.min.css 2.28 kB
build/styles/block-library/navigation/style-rtl.css 3.59 kB
build/styles/block-library/navigation/style-rtl.min.css 2.52 kB
build/styles/block-library/navigation/style.css 3.59 kB
build/styles/block-library/navigation/style.min.css 2.5 kB
build/styles/block-library/nextpage/editor-rtl.css 799 B
build/styles/block-library/nextpage/editor-rtl.min.css 392 B
build/styles/block-library/nextpage/editor.css 800 B
build/styles/block-library/nextpage/editor.min.css 392 B
build/styles/block-library/page-list/editor-rtl.css 1.18 kB
build/styles/block-library/page-list/editor-rtl.min.css 356 B
build/styles/block-library/page-list/editor.css 1.18 kB
build/styles/block-library/page-list/editor.min.css 356 B
build/styles/block-library/page-list/style-rtl.css 207 B
build/styles/block-library/page-list/style-rtl.min.css 192 B
build/styles/block-library/page-list/style.css 207 B
build/styles/block-library/page-list/style.min.css 192 B
build/styles/block-library/paragraph/editor-rtl.css 315 B
build/styles/block-library/paragraph/editor-rtl.min.css 292 B
build/styles/block-library/paragraph/editor.css 314 B
build/styles/block-library/paragraph/editor.min.css 292 B
build/styles/block-library/paragraph/style-rtl.css 746 B
build/styles/block-library/paragraph/style-rtl.min.css 341 B
build/styles/block-library/paragraph/style.css 752 B
build/styles/block-library/paragraph/style.min.css 340 B
build/styles/block-library/playlist-track/style-rtl.css 453 B
build/styles/block-library/playlist-track/style-rtl.min.css 420 B
build/styles/block-library/playlist-track/style.css 453 B
build/styles/block-library/playlist-track/style.min.css 420 B
build/styles/block-library/playlist/editor-rtl.css 120 B
build/styles/block-library/playlist/editor-rtl.min.css 112 B
build/styles/block-library/playlist/editor.css 120 B
build/styles/block-library/playlist/editor.min.css 112 B
build/styles/block-library/playlist/style-rtl.css 1.52 kB
build/styles/block-library/playlist/style-rtl.min.css 1.42 kB
build/styles/block-library/playlist/style.css 1.52 kB
build/styles/block-library/playlist/style.min.css 1.42 kB
build/styles/block-library/post-author-biography/style-rtl.css 96 B
build/styles/block-library/post-author-biography/style-rtl.min.css 86 B
build/styles/block-library/post-author-biography/style.css 96 B
build/styles/block-library/post-author-biography/style.min.css 86 B
build/styles/block-library/post-author-name/style-rtl.css 76 B
build/styles/block-library/post-author-name/style-rtl.min.css 69 B
build/styles/block-library/post-author-name/style.css 76 B
build/styles/block-library/post-author-name/style.min.css 69 B
build/styles/block-library/post-author/editor-rtl.css 490 B
build/styles/block-library/post-author/editor-rtl.min.css 104 B
build/styles/block-library/post-author/editor.css 490 B
build/styles/block-library/post-author/editor.min.css 104 B
build/styles/block-library/post-author/style-rtl.css 213 B
build/styles/block-library/post-author/style-rtl.min.css 188 B
build/styles/block-library/post-author/style.css 214 B
build/styles/block-library/post-author/style.min.css 189 B
build/styles/block-library/post-comments-count/style-rtl.css 79 B
build/styles/block-library/post-comments-count/style-rtl.min.css 72 B
build/styles/block-library/post-comments-count/style.css 79 B
build/styles/block-library/post-comments-count/style.min.css 72 B
build/styles/block-library/post-comments-form/editor-rtl.css 104 B
build/styles/block-library/post-comments-form/editor-rtl.min.css 96 B
build/styles/block-library/post-comments-form/editor.css 104 B
build/styles/block-library/post-comments-form/editor.min.css 96 B
build/styles/block-library/post-comments-form/style-rtl.css 585 B
build/styles/block-library/post-comments-form/style-rtl.min.css 525 B
build/styles/block-library/post-comments-form/style.css 584 B
build/styles/block-library/post-comments-form/style.min.css 525 B
build/styles/block-library/post-comments-link/style-rtl.css 78 B
build/styles/block-library/post-comments-link/style-rtl.min.css 71 B
build/styles/block-library/post-comments-link/style.css 78 B
build/styles/block-library/post-comments-link/style.min.css 71 B
build/styles/block-library/post-content/style-rtl.css 68 B
build/styles/block-library/post-content/style-rtl.min.css 61 B
build/styles/block-library/post-content/style.css 68 B
build/styles/block-library/post-content/style.min.css 61 B
build/styles/block-library/post-date/style-rtl.css 69 B
build/styles/block-library/post-date/style-rtl.min.css 62 B
build/styles/block-library/post-date/style.css 69 B
build/styles/block-library/post-date/style.min.css 62 B
build/styles/block-library/post-excerpt/editor-rtl.css 78 B
build/styles/block-library/post-excerpt/editor-rtl.min.css 71 B
build/styles/block-library/post-excerpt/editor.css 78 B
build/styles/block-library/post-excerpt/editor.min.css 71 B
build/styles/block-library/post-excerpt/style-rtl.css 171 B
build/styles/block-library/post-excerpt/style-rtl.min.css 155 B
build/styles/block-library/post-excerpt/style.css 171 B
build/styles/block-library/post-excerpt/style.min.css 155 B
build/styles/block-library/post-featured-image/editor-rtl.css 1.14 kB
build/styles/block-library/post-featured-image/editor-rtl.min.css 719 B
build/styles/block-library/post-featured-image/editor.css 1.14 kB
build/styles/block-library/post-featured-image/editor.min.css 717 B
build/styles/block-library/post-featured-image/style-rtl.css 392 B
build/styles/block-library/post-featured-image/style-rtl.min.css 347 B
build/styles/block-library/post-featured-image/style.css 392 B
build/styles/block-library/post-featured-image/style.min.css 347 B
build/styles/block-library/post-navigation-link/style-rtl.css 234 B
build/styles/block-library/post-navigation-link/style-rtl.min.css 215 B
build/styles/block-library/post-navigation-link/style.css 245 B
build/styles/block-library/post-navigation-link/style.min.css 214 B
build/styles/block-library/post-template/style-rtl.css 1.27 kB
build/styles/block-library/post-template/style-rtl.min.css 441 B
build/styles/block-library/post-template/style.css 1.27 kB
build/styles/block-library/post-template/style.min.css 441 B
build/styles/block-library/post-terms/style-rtl.css 108 B
build/styles/block-library/post-terms/style-rtl.min.css 96 B
build/styles/block-library/post-terms/style.css 108 B
build/styles/block-library/post-terms/style.min.css 96 B
build/styles/block-library/post-time-to-read/style-rtl.css 77 B
build/styles/block-library/post-time-to-read/style-rtl.min.css 70 B
build/styles/block-library/post-time-to-read/style.css 77 B
build/styles/block-library/post-time-to-read/style.min.css 70 B
build/styles/block-library/post-title/style-rtl.css 175 B
build/styles/block-library/post-title/style-rtl.min.css 162 B
build/styles/block-library/post-title/style.css 175 B
build/styles/block-library/post-title/style.min.css 162 B
build/styles/block-library/preformatted/style-rtl.css 511 B
build/styles/block-library/preformatted/style-rtl.min.css 125 B
build/styles/block-library/preformatted/style.css 511 B
build/styles/block-library/preformatted/style.min.css 125 B
build/styles/block-library/pullquote/editor-rtl.css 146 B
build/styles/block-library/pullquote/editor-rtl.min.css 133 B
build/styles/block-library/pullquote/editor.css 146 B
build/styles/block-library/pullquote/editor.min.css 133 B
build/styles/block-library/pullquote/style-rtl.css 765 B
build/styles/block-library/pullquote/style-rtl.min.css 365 B
build/styles/block-library/pullquote/style.css 764 B
build/styles/block-library/pullquote/style.min.css 365 B
build/styles/block-library/pullquote/theme-rtl.css 195 B
build/styles/block-library/pullquote/theme-rtl.min.css 176 B
build/styles/block-library/pullquote/theme.css 195 B
build/styles/block-library/pullquote/theme.min.css 176 B
build/styles/block-library/query-pagination-numbers/editor-rtl.css 134 B
build/styles/block-library/query-pagination-numbers/editor-rtl.min.css 121 B
build/styles/block-library/query-pagination-numbers/editor.css 144 B
build/styles/block-library/query-pagination-numbers/editor.min.css 118 B
build/styles/block-library/query-pagination/editor-rtl.css 168 B
build/styles/block-library/query-pagination/editor-rtl.min.css 154 B
build/styles/block-library/query-pagination/editor.css 168 B
build/styles/block-library/query-pagination/editor.min.css 154 B
build/styles/block-library/query-pagination/style-rtl.css 254 B
build/styles/block-library/query-pagination/style-rtl.min.css 237 B
build/styles/block-library/query-pagination/style.css 265 B
build/styles/block-library/query-pagination/style.min.css 237 B
build/styles/block-library/query-title/style-rtl.css 71 B
build/styles/block-library/query-title/style-rtl.min.css 64 B
build/styles/block-library/query-title/style.css 71 B
build/styles/block-library/query-title/style.min.css 64 B
build/styles/block-library/query-total/style-rtl.css 71 B
build/styles/block-library/query-total/style-rtl.min.css 64 B
build/styles/block-library/query-total/style.css 71 B
build/styles/block-library/query-total/style.min.css 64 B
build/styles/block-library/query/editor-rtl.css 1.28 kB
build/styles/block-library/query/editor-rtl.min.css 438 B
build/styles/block-library/query/editor.css 1.28 kB
build/styles/block-library/query/editor.min.css 438 B
build/styles/block-library/quote/style-rtl.css 255 B
build/styles/block-library/quote/style-rtl.min.css 238 B
build/styles/block-library/quote/style.css 256 B
build/styles/block-library/quote/style.min.css 238 B
build/styles/block-library/quote/theme-rtl.css 253 B
build/styles/block-library/quote/theme-rtl.min.css 233 B
build/styles/block-library/quote/theme.css 254 B
build/styles/block-library/quote/theme.min.css 236 B
build/styles/block-library/read-more/style-rtl.css 146 B
build/styles/block-library/read-more/style-rtl.min.css 131 B
build/styles/block-library/read-more/style.css 146 B
build/styles/block-library/read-more/style.min.css 131 B
build/styles/block-library/reset-rtl.css 936 B
build/styles/block-library/reset-rtl.min.css 467 B
build/styles/block-library/reset.css 936 B
build/styles/block-library/reset.min.css 467 B
build/styles/block-library/rss/editor-rtl.css 144 B
build/styles/block-library/rss/editor-rtl.min.css 126 B
build/styles/block-library/rss/editor.css 144 B
build/styles/block-library/rss/editor.min.css 126 B
build/styles/block-library/rss/style-rtl.css 1.11 kB
build/styles/block-library/rss/style-rtl.min.css 284 B
build/styles/block-library/rss/style.css 1.12 kB
build/styles/block-library/rss/style.min.css 283 B
build/styles/block-library/search/editor-rtl.css 217 B
build/styles/block-library/search/editor-rtl.min.css 199 B
build/styles/block-library/search/editor.css 217 B
build/styles/block-library/search/editor.min.css 199 B
build/styles/block-library/search/style-rtl.css 1.1 kB
build/styles/block-library/search/style-rtl.min.css 665 B
build/styles/block-library/search/style.css 1.1 kB
build/styles/block-library/search/style.min.css 666 B
build/styles/block-library/search/theme-rtl.css 130 B
build/styles/block-library/search/theme-rtl.min.css 113 B
build/styles/block-library/search/theme.css 130 B
build/styles/block-library/search/theme.min.css 113 B
build/styles/block-library/separator/editor-rtl.css 106 B
build/styles/block-library/separator/editor-rtl.min.css 100 B
build/styles/block-library/separator/editor.css 106 B
build/styles/block-library/separator/editor.min.css 100 B
build/styles/block-library/separator/style-rtl.css 284 B
build/styles/block-library/separator/style-rtl.min.css 248 B
build/styles/block-library/separator/style.css 297 B
build/styles/block-library/separator/style.min.css 248 B
build/styles/block-library/separator/theme-rtl.css 226 B
build/styles/block-library/separator/theme-rtl.min.css 195 B
build/styles/block-library/separator/theme.css 226 B
build/styles/block-library/separator/theme.min.css 195 B
build/styles/block-library/shortcode/editor-rtl.css 1.1 kB
build/styles/block-library/shortcode/editor-rtl.min.css 286 B
build/styles/block-library/shortcode/editor.css 1.1 kB
build/styles/block-library/shortcode/editor.min.css 286 B
build/styles/block-library/site-logo/editor-rtl.css 1.12 kB
build/styles/block-library/site-logo/editor-rtl.min.css 696 B
build/styles/block-library/site-logo/editor.css 1.12 kB
build/styles/block-library/site-logo/editor.min.css 692 B
build/styles/block-library/site-logo/style-rtl.css 239 B
build/styles/block-library/site-logo/style-rtl.min.css 218 B
build/styles/block-library/site-logo/style.css 238 B
build/styles/block-library/site-logo/style.min.css 218 B
build/styles/block-library/site-tagline/editor-rtl.css 94 B
build/styles/block-library/site-tagline/editor-rtl.min.css 87 B
build/styles/block-library/site-tagline/editor.css 94 B
build/styles/block-library/site-tagline/editor.min.css 87 B
build/styles/block-library/site-tagline/style-rtl.css 72 B
build/styles/block-library/site-tagline/style-rtl.min.css 65 B
build/styles/block-library/site-tagline/style.css 72 B
build/styles/block-library/site-tagline/style.min.css 65 B
build/styles/block-library/site-title/editor-rtl.css 93 B
build/styles/block-library/site-title/editor-rtl.min.css 85 B
build/styles/block-library/site-title/editor.css 93 B
build/styles/block-library/site-title/editor.min.css 85 B
build/styles/block-library/site-title/style-rtl.css 153 B
build/styles/block-library/site-title/style-rtl.min.css 143 B
build/styles/block-library/site-title/style.css 153 B
build/styles/block-library/site-title/style.min.css 143 B
build/styles/block-library/social-link/editor-rtl.css 346 B
build/styles/block-library/social-link/editor-rtl.min.css 314 B
build/styles/block-library/social-link/editor.css 348 B
build/styles/block-library/social-link/editor.min.css 314 B
build/styles/block-library/social-links/editor-rtl.css 737 B
build/styles/block-library/social-links/editor-rtl.min.css 339 B
build/styles/block-library/social-links/editor.css 738 B
build/styles/block-library/social-links/editor.min.css 338 B
build/styles/block-library/social-links/style-rtl.css 1.57 kB
build/styles/block-library/social-links/style-rtl.min.css 1.51 kB
build/styles/block-library/social-links/style.css 1.57 kB
build/styles/block-library/social-links/style.min.css 1.51 kB
build/styles/block-library/spacer/editor-rtl.css 774 B
build/styles/block-library/spacer/editor-rtl.min.css 346 B
build/styles/block-library/spacer/editor.css 774 B
build/styles/block-library/spacer/editor.min.css 346 B
build/styles/block-library/spacer/style-rtl.css 55 B
build/styles/block-library/spacer/style-rtl.min.css 48 B
build/styles/block-library/spacer/style.css 55 B
build/styles/block-library/spacer/style.min.css 48 B
build/styles/block-library/style-rtl.css 21.5 kB
build/styles/block-library/style-rtl.min.css 18 kB
build/styles/block-library/style.css 21.6 kB
build/styles/block-library/style.min.css 18 kB
build/styles/block-library/tab-list/editor-rtl.css 107 B
build/styles/block-library/tab-list/editor-rtl.min.css 97 B
build/styles/block-library/tab-list/editor.css 107 B
build/styles/block-library/tab-list/editor.min.css 97 B
build/styles/block-library/tab-panel/style-rtl.css 238 B
build/styles/block-library/tab-panel/style-rtl.min.css 215 B
build/styles/block-library/tab-panel/style.css 238 B
build/styles/block-library/tab-panel/style.min.css 215 B
build/styles/block-library/tab-panels/style-rtl.css 76 B
build/styles/block-library/tab-panels/style-rtl.min.css 65 B
build/styles/block-library/tab-panels/style.css 76 B
build/styles/block-library/tab-panels/style.min.css 65 B
build/styles/block-library/tab/editor-rtl.css 160 B
build/styles/block-library/tab/editor-rtl.min.css 148 B
build/styles/block-library/tab/editor.css 160 B
build/styles/block-library/tab/editor.min.css 148 B
build/styles/block-library/tab/style-rtl.css 397 B
build/styles/block-library/tab/style-rtl.min.css 352 B
build/styles/block-library/tab/style.css 398 B
build/styles/block-library/tab/style.min.css 356 B
build/styles/block-library/table-of-contents/style-rtl.css 89 B
build/styles/block-library/table-of-contents/style-rtl.min.css 83 B
build/styles/block-library/table-of-contents/style.css 89 B
build/styles/block-library/table-of-contents/style.min.css 83 B
build/styles/block-library/table/editor-rtl.css 1.25 kB
build/styles/block-library/table/editor-rtl.min.css 394 B
build/styles/block-library/table/editor.css 1.25 kB
build/styles/block-library/table/editor.min.css 394 B
build/styles/block-library/table/style-rtl.css 1.06 kB
build/styles/block-library/table/style-rtl.min.css 641 B
build/styles/block-library/table/style.css 1.06 kB
build/styles/block-library/table/style.min.css 640 B
build/styles/block-library/table/theme-rtl.css 985 B
build/styles/block-library/table/theme-rtl.min.css 152 B
build/styles/block-library/table/theme.css 985 B
build/styles/block-library/table/theme.min.css 152 B
build/styles/block-library/tabs/style-rtl.css 64 B
build/styles/block-library/tabs/style-rtl.min.css 57 B
build/styles/block-library/tabs/style.css 64 B
build/styles/block-library/tabs/style.min.css 57 B
build/styles/block-library/tag-cloud/style-rtl.css 283 B
build/styles/block-library/tag-cloud/style-rtl.min.css 248 B
build/styles/block-library/tag-cloud/style.css 283 B
build/styles/block-library/tag-cloud/style.min.css 248 B
build/styles/block-library/template-part/editor-rtl.css 1.2 kB
build/styles/block-library/template-part/editor-rtl.min.css 368 B
build/styles/block-library/template-part/editor.css 1.2 kB
build/styles/block-library/template-part/editor.min.css 368 B
build/styles/block-library/template-part/theme-rtl.css 492 B
build/styles/block-library/template-part/theme-rtl.min.css 113 B
build/styles/block-library/template-part/theme.css 492 B
build/styles/block-library/template-part/theme.min.css 113 B
build/styles/block-library/term-count/style-rtl.css 70 B
build/styles/block-library/term-count/style-rtl.min.css 63 B
build/styles/block-library/term-count/style.css 70 B
build/styles/block-library/term-count/style.min.css 63 B
build/styles/block-library/term-description/style-rtl.css 138 B
build/styles/block-library/term-description/style-rtl.min.css 126 B
build/styles/block-library/term-description/style.css 138 B
build/styles/block-library/term-description/style.min.css 126 B
build/styles/block-library/term-name/style-rtl.css 69 B
build/styles/block-library/term-name/style-rtl.min.css 62 B
build/styles/block-library/term-name/style.css 69 B
build/styles/block-library/term-name/style.min.css 62 B
build/styles/block-library/term-template/editor-rtl.css 267 B
build/styles/block-library/term-template/editor-rtl.min.css 225 B
build/styles/block-library/term-template/editor.css 267 B
build/styles/block-library/term-template/editor.min.css 225 B
build/styles/block-library/term-template/style-rtl.css 124 B
build/styles/block-library/term-template/style-rtl.min.css 114 B
build/styles/block-library/term-template/style.css 124 B
build/styles/block-library/term-template/style.min.css 114 B
build/styles/block-library/text-columns/editor-rtl.css 481 B
build/styles/block-library/text-columns/editor-rtl.min.css 95 B
build/styles/block-library/text-columns/editor.css 481 B
build/styles/block-library/text-columns/editor.min.css 95 B
build/styles/block-library/text-columns/style-rtl.css 177 B
build/styles/block-library/text-columns/style-rtl.min.css 165 B
build/styles/block-library/text-columns/style.css 177 B
build/styles/block-library/text-columns/style.min.css 165 B
build/styles/block-library/theme-rtl.css 1.59 kB
build/styles/block-library/theme-rtl.min.css 715 B
build/styles/block-library/theme.css 1.6 kB
build/styles/block-library/theme.min.css 719 B
build/styles/block-library/verse/style-rtl.css 155 B
build/styles/block-library/verse/style-rtl.min.css 137 B
build/styles/block-library/verse/style.css 155 B
build/styles/block-library/verse/style.min.css 137 B
build/styles/block-library/video/editor-rtl.css 839 B
build/styles/block-library/video/editor-rtl.min.css 428 B
build/styles/block-library/video/editor.css 840 B
build/styles/block-library/video/editor.min.css 428 B
build/styles/block-library/video/style-rtl.css 1.02 kB
build/styles/block-library/video/style-rtl.min.css 202 B
build/styles/block-library/video/style.css 1.02 kB
build/styles/block-library/video/style.min.css 202 B
build/styles/block-library/video/theme-rtl.css 967 B
build/styles/block-library/video/theme-rtl.min.css 134 B
build/styles/block-library/video/theme.css 967 B
build/styles/block-library/video/theme.min.css 134 B
build/styles/commands/style-rtl.css 2.07 kB
build/styles/commands/style-rtl.min.css 1.17 kB
build/styles/commands/style.css 2.06 kB
build/styles/commands/style.min.css 1.17 kB
build/styles/components/style-rtl.css 17.8 kB
build/styles/components/style-rtl.min.css 14.7 kB
build/styles/components/style.css 17.9 kB
build/styles/components/style.min.css 14.8 kB
build/styles/customize-widgets/style-rtl.css 2.35 kB
build/styles/customize-widgets/style-rtl.min.css 1.44 kB
build/styles/customize-widgets/style.css 2.35 kB
build/styles/customize-widgets/style.min.css 1.44 kB
build/styles/edit-post/classic-rtl.css 1.29 kB
build/styles/edit-post/classic-rtl.min.css 425 B
build/styles/edit-post/classic.css 1.31 kB
build/styles/edit-post/classic.min.css 428 B
build/styles/edit-post/experimental-admin-bar-in-editor-rtl.css 550 B
build/styles/edit-post/experimental-admin-bar-in-editor-rtl.min.css 513 B
build/styles/edit-post/experimental-admin-bar-in-editor.css 551 B
build/styles/edit-post/experimental-admin-bar-in-editor.min.css 514 B
build/styles/edit-post/style-rtl.css 3.8 kB
build/styles/edit-post/style-rtl.min.css 2.48 kB
build/styles/edit-post/style.css 3.81 kB
build/styles/edit-post/style.min.css 2.49 kB
build/styles/edit-site/experimental-admin-bar-in-editor-rtl.css 502 B
build/styles/edit-site/experimental-admin-bar-in-editor-rtl.min.css 474 B
build/styles/edit-site/experimental-admin-bar-in-editor.css 502 B
build/styles/edit-site/experimental-admin-bar-in-editor.min.css 474 B
build/styles/edit-site/style-rtl.css 21.3 kB
build/styles/edit-site/style-rtl.min.css 17.4 kB
build/styles/edit-site/style.css 21.3 kB
build/styles/edit-site/style.min.css 17.4 kB
build/styles/edit-widgets/style-rtl.css 4.85 kB
build/styles/edit-widgets/style-rtl.min.css 3.52 kB
build/styles/edit-widgets/style.css 4.85 kB
build/styles/edit-widgets/style.min.css 3.52 kB
build/styles/editor/style-rtl.css 29.4 kB
build/styles/editor/style-rtl.min.css 24.9 kB
build/styles/editor/style.css 29.4 kB
build/styles/editor/style.min.css 24.9 kB
build/styles/format-library/style-rtl.css 735 B
build/styles/format-library/style-rtl.min.css 326 B
build/styles/format-library/style.css 746 B
build/styles/format-library/style.min.css 326 B
build/styles/list-reusable-blocks/style-rtl.css 1.03 kB
build/styles/list-reusable-blocks/style-rtl.min.css 210 B
build/styles/list-reusable-blocks/style.css 1.03 kB
build/styles/list-reusable-blocks/style.min.css 211 B
build/styles/media-utils/style-rtl.css 2.12 kB
build/styles/media-utils/style-rtl.min.css 1.2 kB
build/styles/media-utils/style.css 2.11 kB
build/styles/media-utils/style.min.css 1.2 kB
build/styles/notices/style-rtl.css 121 B
build/styles/notices/style-rtl.min.css 106 B
build/styles/notices/style.css 121 B
build/styles/notices/style.min.css 106 B
build/styles/nux/style-rtl.css 1.48 kB
build/styles/nux/style-rtl.min.css 622 B
build/styles/nux/style.css 1.5 kB
build/styles/nux/style.min.css 618 B
build/styles/patterns/style-rtl.css 1.46 kB
build/styles/patterns/style-rtl.min.css 611 B
build/styles/patterns/style.css 1.46 kB
build/styles/patterns/style.min.css 611 B
build/styles/preferences/style-rtl.css 1.26 kB
build/styles/preferences/style-rtl.min.css 415 B
build/styles/preferences/style.css 1.26 kB
build/styles/preferences/style.min.css 415 B
build/styles/reusable-blocks/style-rtl.css 1.11 kB
build/styles/reusable-blocks/style-rtl.min.css 275 B
build/styles/reusable-blocks/style.css 1.11 kB
build/styles/reusable-blocks/style.min.css 275 B
build/styles/widgets/style-rtl.css 2.05 kB
build/styles/widgets/style-rtl.min.css 1.16 kB
build/styles/widgets/style.css 2.06 kB
build/styles/widgets/style.min.css 1.16 kB

compressed-size-action

@ellatrix ellatrix force-pushed the perf/share-rich-text-document-listeners branch from 889189c to c0de9b8 Compare May 14, 2026 21:27
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Flaky tests detected in aa309f0.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26174943358
📝 Reported issues:

@ellatrix ellatrix changed the title Rich text: Share window listeners across RichText instances Blocks: Share window listeners across instances (block props, rich text, ...) May 19, 2026
@ellatrix ellatrix requested a review from ajitbohra as a code owner May 19, 2026 10:54
@github-actions github-actions Bot added the [Package] Compose /packages/compose label May 19, 2026
@ellatrix ellatrix added the [Type] Performance Related to performance efforts label May 19, 2026
@ellatrix ellatrix requested a review from a team as a code owner May 19, 2026 11:29
@github-actions github-actions Bot added the [Package] Components /packages/components label May 19, 2026
@ellatrix ellatrix requested a review from fabiankaegy as a code owner May 19, 2026 12:00
@github-actions github-actions Bot added the [Package] Block library /packages/block-library label May 19, 2026
ellatrix and others added 15 commits May 19, 2026 14:01
Each RichText hook setup adds four `addEventListener` calls to the
shared `defaultView` (`copy` / `cut` from copy-handler,
`pointerdown` / `pointerup` from prevent-focus-capture). Every handler
short-circuits when the rich-text isn't the focused one, so N
listeners do the work of 1 — the rest are pure JS↔C++ boundary
crossings on mount.

With many rich-text instances mounted at once (paragraphs, headings,
buttons, lists in a large post each contain a RichText), the
boundary-crossing cost is the largest remaining source of
`addEventListener` time during the React commit — ~50 ms total in a
representative post-editor first-block trace, of which ~10 ms is the
shared-target subset this change addresses.

Introduce `subscribeSharedListener( target, eventType, callback )` in
`packages/rich-text/src/hook/event-listeners/shared-listener.js`:
keeps a `WeakMap<EventTarget, Map<eventType, Set<callback>>>` and
attaches one native listener per (target, type) that fans out to
every subscriber. Refactor `copy-handler` and `prevent-focus-capture`
to use it. Same handler semantics, same call order, no API change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…handlers

Both `enter` (block-editor/rich-text/event-listeners/enter.js) and
`paste-handler` (same dir) attach their listeners to `defaultView` so
parent elements can intercept first. Each handler then checks
`event.target === element` (or `element.contains(event.target)`) and
short-circuits if the rich-text isn't the focused one — same pattern
as `copy-handler` and `prevent-focus-capture`.

Route both through the shared registry so all RichText instances share
one native `keydown` / `paste` listener on the window instead of one
each. Expose `subscribeSharedListener` from `@wordpress/rich-text`'s
private APIs so block-editor can use the same helper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move `delete.js`'s `keydown` listener off the contenteditable and onto
`ownerDocument` via `subscribeSharedListener`. The handler now bails
if our editable isn't the focused element, mirroring the
`copy-handler` / `prevent-focus-capture` pattern. Behaviour for
Backspace/Delete-of-all-selected-content is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move `format-boundaries.js`'s `keydown` listener off the contenteditable
and onto `ownerDocument` via `subscribeSharedListener`, following the
same pattern as `delete.js`. The handler bails when our editable isn't
the focused element. Behaviour for LEFT/RIGHT at format boundaries is
unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`use-arrow-nav.js` in block-editor gates on `event.defaultPrevented`
and assumes rich-text's `format-boundaries` keydown handler has already
run. With the shared listener on `ownerDocument` in bubble phase, that
ordering reversed: ancestor element listeners fired before the
document-level handler.

Extend `subscribeSharedListener` with a capture-phase option and switch
`format-boundaries` to use it. The handler now fires before any
ancestor bubble listeners up the chain, restoring the original
`defaultPrevented` contract.

Fixes the inline-boundary navigation regressions in
`writing-flow.spec.js` and `rtl.spec.js`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move `select-object.js`'s `click` and `focusin` listeners off the
contenteditable and onto `ownerDocument` via `subscribeSharedListener`,
in bubble phase. Add an explicit `! element.contains( event.target )`
guard at the top of `onClick` — the previous implicit guard only worked
because the listener was element-scoped. `onFocusIn` is unchanged; its
delegation to `onClick` is filtered by the new guard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…change compat

Move `selection-change-compat.js`'s `pointerdown` and `keydown` listeners
off the contenteditable and onto `ownerDocument` via
`subscribeSharedListener` (bubble phase). Add an
`! element.contains( event.target )` guard at the top of `onDown` so
only the matching instance schedules its transient up/cancel listeners
and dispatches the synthetic `selectionchange`.

The transient inner listeners (`pointerup`/`keyup`, `selectionchange`,
`input`) are unchanged — they are per-event, not per-mount, and
self-cancel.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move `input-and-selection.js`'s `input`, `compositionstart`,
`compositionend`, and `focus` listeners off the contenteditable and
onto `ownerDocument` via `subscribeSharedListener` (bubble phase).

- `input` / `compositionstart` / `compositionend`: guarded by
  `! element.contains( event.target ) → return`. The `onInput` guard
  is conditional because `onCompositionEnd` synthetically invokes
  `onInput({ inputType: 'insertText' })` with no real event.
- `focus`: switched to `focusin` since `focus` doesn't bubble; guarded
  by `event.target !== element` to preserve strict element-level
  `focus` semantics (a focusable descendant getting focus didn't
  trigger the old listener).

This was the last per-instance element-level listener in the rich-text
hook. All seven event-listener modules now share their native
listeners across rich-text instances.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…eners

`block-editor`'s `input-rules.js` and `input-events.js` attach
element-level `input` / `compositionend` listeners and read
`getValue()` (which reads `record.current`). Rich-text's own `onInput`
must run first to update `record.current`, otherwise input-rules sees
stale text and trigger patterns (`>` → quote, `\`` → code,
`---` → separator) stop matching.

Semantically this is the right phase: `input` fires after the browser
has mutated the DOM, and rich-text's job is to sync its internal
record to that mutation before any consumer reads it. Capture-phase
expresses "I establish baseline state for this event."

Fixes the quote / backtick / separator transformation regressions in
the e2e suite.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
A locked binding paragraph has `contentEditable="false"` but still
`tabindex=0`, so it can receive focus. With rich-text's `onFocus` now
on a shared `focusin` listener it ran on doc-bubble — after
block-editor's element-level `use-focus-handler.js`. The latter
already dispatches `selectionChange(clientId)` (no `attributeKey`) for
focus on a non-editable target, but our handler then ran second and
re-set `attributeKey: 'content'`, leaving the rich text "selected for
editing" and the inline format toolbar (Bold, Italic, Link) visible.

Mirror the existing guard in `handleSelectionChange` (line 120) and
bail in `onFocus` when `contentEditable !== 'true'`. The rich text
shouldn't claim selection when it isn't actually editable.

Fixes the block-bindings "should lock editing" regressions in
custom-sources.spec.js.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Migrate `useFocusHandler`'s per-block `focusin` listener to a shared
`subscribeSharedListener( node.ownerDocument, 'focusin', … )` with a
`! node.contains( event.target )` bail at the top. Collapses ~N native
focusin listeners (one per mounted block) into one shared document
listener.

Subscription ordering is preserved: rich-text's `useEventListeners`
is composed inside `useRichText`, whose `useRefEffect` runs before the
block wrapper's `useRefEffect` in the ref chain (see
`block-editor/src/components/rich-text/index.js:427-457`). So per
focusin, rich-text's onFocus fires first and use-focus-handler fires
second — same order as trunk (`focus` → `focusin`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Migrate `useIsHovered`'s per-block `mouseover` / `mouseout` listeners
to a shared `subscribeSharedListener( node.ownerDocument, …, bubble )`
with a `! node.contains( event.target )` bail. For each event, only
the subscribers whose wrapper contains the target toggle their own
`is-hovered` class — preserves the existing nested-block behavior
(both Paragraph and parent Group get the class when hovering a child
of Paragraph).

Collapses ~2×N native listeners (one mouseover + one mouseout per
hover-enabled block) into 2 shared document listeners.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move the `subscribeSharedListener` helper from
`packages/rich-text/src/hook/event-listeners/shared-listener.js` to
`@wordpress/compose` as a public utility. Lower-layer packages such as
`@wordpress/components` can now consume it without depending on
`@wordpress/rich-text` (which would be a layer reversal).

All seven rich-text event-listener modules and the four block-editor
consumers (`enter`, `paste-handler`, `use-focus-handler`,
`use-is-hovered`) now import the helper from `@wordpress/compose`
directly. The helper is no longer re-exported from rich-text's
private API.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The helper was added as a `.js` file but the compose `tsconfig` has
`checkJs: true` + `strict`, which flagged the implicit `any` parameter
types. Convert to `.ts` with explicit types: `target: EventTarget`,
`eventType: string`, `callback: ( event: Event ) => void`,
`capture: boolean = false`.

No runtime change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Migrate `useAutocompleteProps`'s per-instance `keydown` listener to a
shared `subscribeSharedListener( ownerDocument, 'keydown', …, capture )`
with a `! element.contains( event.target )` bail. Collapses ~N native
keydown listeners (one per RichText) into one shared document
capture-phase listener.

Capture phase: when the autocomplete popover is open,
Up/Down/Enter/Escape must navigate the completion list — they
shouldn't be consumed by ancestor handlers (e.g. block-editor's
writing-flow) for block navigation, block splitting, or "move out of
parent" actions. Those handlers fire at bubble phase and gate on
`event.defaultPrevented`, so firing in capture lets us `preventDefault`
first when the popover is active.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ellatrix and others added 2 commits May 19, 2026 14:01
`subscribeSharedListener`'s `Listener` type is `(event: Event) => void`,
but the previous commit passed a `(event: KeyboardEvent) => void`
callback. With strict mode, function parameter types are contravariant,
so the narrower signature isn't assignable.

Widen `_onKeyDown` to `(event: Event) => void` and cast to
`KeyboardEvent` when delegating to `onKeyDownRef.current`. The shape of
the keydown event at runtime is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Migrate the per-block-on-mount `keydown` listeners in:

- `paragraph/use-enter.js`
- `list-item/hooks/use-enter.js`
- `list-item/hooks/use-space.js`
- `button/edit.js` (the local `useEnter`)

to a shared `subscribeSharedListener( ownerDocument, 'keydown', …,
capture )` with a `! element.contains( event.target )` bail. Each
collapses ~N native listeners (one per mounted paragraph / list item /
button) into one shared document capture-phase subscription.

Capture phase preserves the existing ordering contract: on trunk these
listeners ran at target phase on the inner block element, so they
fired before writing-flow's ancestor-bubble handlers (`use-input.js`,
`use-arrow-nav.js`), which gate on `event.defaultPrevented` to defer
to the more specific consumer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ellatrix ellatrix force-pushed the perf/share-rich-text-document-listeners branch from b312e8f to 37bf7c6 Compare May 19, 2026 12:01
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ellatrix ellatrix force-pushed the perf/share-rich-text-document-listeners branch from 37bf7c6 to 6e208e4 Compare May 19, 2026 12:06
Replace `! element.contains( event.target )` with `event.target !==
element` (and `! element.contains( activeElement )` with the
event.target check) in the shared subscribers whose events fire on the
focused leaf element:

- `rich-text/delete.js`
- `rich-text/format-boundaries.js`
- `rich-text/input-and-selection.js` (input, compositionstart, compositionend)
- `paragraph/use-enter.js`
- `list-item/use-enter.js`
- `list-item/use-space.js`
- `button/edit.js` useEnter
- `components/Autocomplete`

Keydown/input/composition fire on the focused element directly — for
the leaf contenteditable that hosts these handlers there are no
focusable descendants in core blocks, so `target === element` is
sufficient and cheaper than a DOM walk.

`select-object.js`, `selection-change-compat.js`, `use-focus-handler.js`,
and `use-is-hovered.js` keep `contains()` — their events (click,
pointerdown, focusin, mouseover/mouseout) can legitimately fire on
descendants (`<strong>` in formatted text, focusable children of a
block wrapper, etc.).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
// inside this block's wrapper.
if ( ! node.contains( event.target ) ) {
return;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect the node check to be inside subscribeSharedListener. The React event system has only one document listener and then calls individual node listeners according to event.target. Our version calls all listeners on all events, even when they happen in a different element.

A better API would be:

subscribeSharedListener( node, 'focusin', onFocus );

where the onFocus handler is called only when the event really happens inside node, and the helper can figure out node.ownerDocument from the node.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a good idea. Adjusted 🙂

ellatrix and others added 4 commits May 20, 2026 10:58
Per @jsnajdr's review: instead of every callback running on every event
with a manual `! element.contains( event.target )` bail, let the helper
accept the bound element directly and dispatch via a target → ancestors
walk — only callbacks bound to a node on the event path get invoked.
Mirrors how React's synthetic event system works.

The helper now accepts `Element | Document | Window` as the target:

- `Element`: attaches one native listener at `element.ownerDocument`,
  maintains a per-element registry, dispatches via DOM ancestry. Capture
  phase walks root-to-target; bubble walks target-to-root.
- `Document`: always dispatches (document is the root of every event in
  it, so it's naturally on every ancestry path).
- `Window`: flat fan-out (window isn't on the DOM tree).

All element-scoped call sites switched from passing
`element.ownerDocument` to passing `element` directly, and drop their
own `! element.contains( event.target )` / `event.target !== element`
guard at the top of the callback. Window-scoped subscriptions
(`copy-handler`, `prevent-focus-capture`, block-editor `enter` /
`paste-handler`) are unchanged — they intentionally observe events
outside the rich-text.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`instanceof Document` returns false when the target is a document from
a different realm — e.g. the editor canvas iframe's document, whose
constructor is iframe.contentWindow.Document, not the parent window's
Document. The check fell through to `target.ownerDocument`, which is
`null` for a Document, then `registries.set(null, …)` threw
"Invalid value used as weak map key" during rich-text mount inside the
canvas iframe.

Switch to duck-typing checks that work across realms:

- `target.nodeType === 9` (DOCUMENT_NODE) for Document
- `target.window === target` for Window

Also bundles the bubble-phase inline dispatch optimisation from the
walk benchmark (no path-array allocation for the common case).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`subscribeSharedListener` is not intended for use in themes or plugins
— it relies on subscribers cooperating about phase ordering and
target scoping, and the wrong call shape can corrupt the shared
registry. Move it from a public export to `privateApis` via the
standard `__dangerousOptInToUnstableAPIsOnlyForCoreModules` pattern.

Introduces private-API plumbing in compose for the first time:

- New `packages/compose/src/lock-unlock.ts`
- New `packages/compose/src/private-apis.ts` (exports `privateApis`
  with `subscribeSharedListener` locked inside)
- `@wordpress/private-apis` added as a compose dependency
- Public export removed from `packages/compose/src/index.js`

All 16 consumers (7 in rich-text, 4 in block-editor, 4 in
block-library, 1 in components) updated to
`unlock( composePrivateApis )`. Behaviour unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Required since the previous commit moved `subscribeSharedListener`
behind compose's private API. Without this entry the allowlist throws
during compose's `__dangerousOptInToUnstableAPIsOnlyForCoreModules`
call.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the [Package] Private APIs /packages/private-apis label May 20, 2026
ellatrix and others added 2 commits May 20, 2026 14:31
Validate-tsconfig requires explicit project references for each
package dependency. Added when introducing compose's privateApis but
the tsconfig wasn't updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Missed running `npm install` after adding the dependency in the
"Make subscribeSharedListener private" commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
import { store as blockEditorStore } from '../../../store';
import { unlock } from '../../../lock-unlock';

const { subscribeSharedListener } = unlock( composePrivateApis );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't be afraid to make it public immediately. It's a solid API and there are no doubts about its usefulness.

One little suggestion: instead of the capture param, support options = { capture } object. Or both, the goal is symmetry with addEventListener.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I'm not sure of is the naming 😆

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about subscribeDocumentListener, but that doesn't work very well for window 🙂

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addSharedListener ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be "add" because it doesn't behave like addEventListener. It returns an unsubscribe callback, there is no "remove" function like removeEventListener. So, the "subscribe" part is right 🙂 It's about the adjective: "shared listener", "document listener"?

I asked Cursor (inside React repo context, where this pattern is used for the entire event system) and it says firmly it should be subscribeDelegatedListener, insisting that "event delegation" is a standard established name for what we're doing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like subscribeDelegatedListener

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed, but I'll leave it private for now. It's always easy to make public.

}
set.add( callback );
return () => {
set?.delete( callback );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the optional chaining is not needed, set is always valid. set.add is called one line before and the variable is not going to disappear.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also weird that the listener is never removed. It becomes a noop when the subscribers set becomes empty, but stays there forever.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but it's one listener by event type per document, so not sure if there's much value. Your comment actually made me realize it wasn't using a weak map, so added that now. That should take care of iframes being deleted

* to `false`.
* @return Unsubscribe function.
*/
type Listener = ( event: Event ) => void;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's native EventListener type for this, similar to EventTarget that we already use.

ellatrix and others added 2 commits May 20, 2026 18:08
Per review feedback from @jsnajdr, address two leaks/nits:

1. **WeakMap inner registry** — Element subscribers are now held weakly
   so an iframe removal lets the iframe's Elements (and through them,
   `ownerDocument`) be garbage-collected. Without this, the registry
   kept Element keys strong, and Element keys hold `ownerDocument`
   strong, so even after an iframe is yanked out of the DOM the
   document would stay alive (and so would the native listener attached
   to it). The native listener is attached to the document itself, so
   it goes when the document goes — no explicit `removeEventListener`
   needed.

   Window fan-out is updated to fetch the single window-keyed Set via
   `subscribers.get( root )` rather than iterating `.values()` — all
   window-bound subscribers share the same key (the window itself), so
   one lookup suffices and WeakMap doesn't need to be iterable.

2. **Use the native `EventListener` type** rather than rolling our own
   `Listener` alias.

3. **Drop defensive optional chaining** on `set?.delete()` — `set` is
   guaranteed to exist (`set.add` ran on the line above).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per review feedback: "delegated" describes what the helper does (event
delegation) rather than how it's implemented. Renames the function,
its module directory, and all 16 consumer call sites.

No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ellatrix ellatrix merged commit 463ee32 into trunk May 20, 2026
45 of 47 checks passed
@ellatrix ellatrix deleted the perf/share-rich-text-document-listeners branch May 20, 2026 19:40
@github-actions github-actions Bot added this to the Gutenberg 23.3 milestone May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Package] Block library /packages/block-library [Package] Components /packages/components [Package] Compose /packages/compose [Package] Private APIs /packages/private-apis [Package] Rich text /packages/rich-text [Type] Performance Related to performance efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants